﻿using System.ComponentModel;
using Microsoft.Practices.Unity;
using ORM.Business.Interfaces;
using ORM.Business.Repositories;

namespace ORM.Business.Configuration
{
    // Includes configuration for ORM.Business assembly to be used with Unity Container
    public class BusinessUnityExtension : UnityContainerExtension
    {
        #region Overrides of UnityContainerExtension

        protected override void Initialize()
        {
            RegisterRepositories();
        }
        #endregion
        private void RegisterRepositories()
        {
            //Register all repositories here
            Container.RegisterType<ISecurityRepository, SecurityRepository>(new ContainerControlledLifetimeManager())
                .RegisterType<IQuestionRepository, QuestionRepository>(new ContainerControlledLifetimeManager())
                 .RegisterType<IGuideTypeRepository, GuideTypeRepository>(new ContainerControlledLifetimeManager())
                .RegisterType<IManufacturerRepository, ManufacturerRepository>(new ContainerControlledLifetimeManager())
                .RegisterType<IDeviceRepository, DeviceRepository>(new ContainerControlledLifetimeManager())
                .RegisterType<IModelRepository, ModelRepository>(new ContainerControlledLifetimeManager())
                .RegisterType<IAnswerRepository, AnswerRepository>(new ContainerControlledLifetimeManager())
                .RegisterType<IGuideRepository, GuideRepository>(new ContainerControlledLifetimeManager())
                .RegisterType<IUserRepository, UserRepository>(new ContainerControlledLifetimeManager())
                .RegisterType<IReferenceDataRepository, ReferenceDataRepository>(
                    new ContainerControlledLifetimeManager())
                .RegisterType<ICommentRepository, CommentRepository>(new ContainerControlledLifetimeManager())
                .RegisterType<IApplicationRepository, ApplicationRepository>(new ContainerControlledLifetimeManager());


        }
    }
}
